package com.gjy.netty.codec;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.ReplayingDecoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;

/**
 * @author 宫静雨
 * @version 1.0
 * @since 2023-01-10 13:51:27
 */
public class Byte2integerReplayDecoder extends ReplayingDecoder<Void> {

    private static final Logger logger = LoggerFactory.getLogger(Byte2integerReplayDecoder.class);

    @Override
    protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
        int e = in.readInt();
        logger.info("解码: {}", e);
        out.add(e);
    }
}
